Feat/affichage swagger#1055
Conversation
when using asdf as node version manager, .tool-versions is required
5d5a086 to
c025711
Compare
Blocked by CORS, need to make a proxy in dev environment. Adds: - nuxt.config.ts: Vite dev proxy for entreprise.api.gouv.fr and particulier.api.gouv.fr - utils/openapi-proxy.ts: client-side URL rewriter that maps external swagger URLs to the local dev proxy paths
c025711 to
9f56088
Compare
nicolaskempf57
left a comment
There was a problem hiding this comment.
Thanks for your PR 🙏🏻
I'm not quite clear on the product /usability side. I find that having multiple banners reduce the purpose of the use of the banner component in the page.
| @@ -0,0 +1,163 @@ | |||
| // Generic OpenAPI 2.0 / 3.x extractor. | |||
There was a problem hiding this comment.
Are both API v2 and v3 required for your use case ?
It would be great if this file could be merged with datagouv-components/src/components/OpenApiViewer/openapi.ts
There was a problem hiding this comment.
it's meant to be generic for any swagger fed by our data providers so we might need v2 and v3 in principle. Will check if we have a lot of V2 swaggers to manage however
There was a problem hiding this comment.
We have 21 swagger 2.0 VS 219 OpenAPI 3.0 so probably better to not refactorise for now, WDYT?
| </div> | ||
|
|
||
| <div class="container space-y-4"> | ||
| <SimpleBanner |
There was a problem hiding this comment.
Could it be added to the existing banner in datagouv-components/src/components/OpenApiViewer/OpenApiViewer.vue ? Or moved to an AccordionGroup ? I find it strange to have many banners stacked
There was a problem hiding this comment.
The OpenAPI Viewer right now is for technical documentation, the current PR is aimed at providing non-tech with business (métier) information.
We could move to an AccordionGroup, I propose to ask @DorineLam for her input in UI/UX if the current up-to-3 banners stack is too much
There was a problem hiding this comment.
Hello, c'est possible pour vous de m'envoyer une preview ou au mini une capture écran ?
|
Thanks, will correct all of that 👍 I just arrived on this product and still very junior on those stacks, so feedback is very welcome 🙏 |
Adds a recursive OpenApiProperty component and an OpenApiProperties wrapper that fetches the dataservice's OpenAPI YAML, extracts the response schema for the matching endpoint, and renders the fields as a structured property tree. Matching uses the dataservice title against endpoint summaries (Bouquet API Entreprise/Particulier conventions). Descriptions render as sanitized HTML via DOMPurify. A loader appears while the YAML is fetched and parsed client-side. The property tree is hosted in a collapsible "Données renvoyées" banner on the dataservice page, matching the existing Swagger banner's pattern.
Generalises the property tree to work with any OpenAPI 2.0 or 3.x spec, not just Bouquet API Entreprise/Particulier. A new utils/openapi-extract module resolves internal $ref pointers, flattens allOf, takes the first variant of oneOf/anyOf, and handles both v2 (responses.200.schema) and v3 (responses.200.content.application/json.schema) response locations. The Bouquet-specific data-wrapper unwrap and title-based filter become post-hoc transforms applied only when the title matches the Bouquet pattern. Non-Bouquet dataservices now render all endpoints with their HTTP method prefixed (GET, POST, ...) in the heading. The property tree banner loses its redundant heading and gets a white inner background.
9f56088 to
dae10e5
Compare
fix datagouv/data.gouv.fr#1906
1e3f3f8 is for testing, will drop before merge unless someone asks me not to
J'ai pas fait de JS ni de vue ni de typescript depuis un bail donc hésitez pas à me remonter les bretelles
Aussi pas testé car je suis pas sûr de votre politique de test mais je peux ajouter des tests
Note: je vais probablement remplacer le filtrage par nom de provider pour les bouquets API E/P avec un filtre coté API E/P